package com.ysd.app;

import com.ysd.app.controller.ChatRoomServerEndpoint;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

/**
 * * 激活WebSocket：@EnableWebSocket
 */
@SpringBootApplication
@EnableWebSocket
public class SpringbootwebsocketApplication{
	public static void main(String[] args) {
		SpringApplication.run(SpringbootwebsocketApplication.class, args);
		System.out.println("--------end---------");
	}
	/**
	 * * 注册 ServerEndpointExporter Bean对象（因为Springboot没有自动注册，所以得手动注册）
	 */
	@Bean
	public ServerEndpointExporter serverEndpointExporter() {
		return new ServerEndpointExporter();
	}
	/**
	 * * 注册 端点对象
	 */
	@Bean
	public ChatRoomServerEndpoint chatRoomServerEndpoint() {
		return new ChatRoomServerEndpoint();

	}

}
